package org.exteen.output;

import java.io.Writer;

public class ExteenStream {

    protected final ExteenWriter writer;

    public ExteenStream(Writer writer) {
        this.writer = new ExteenWriter(writer);
    }

    protected ExteenStream(ExteenStream base) {
        this.writer = base.writer;
    }

    public void printAttribute(String key, String value) {
        this.writer.print(" " + key + "=");
        if (value.indexOf('\"') >= 0) {
            value = value.replaceAll("\"", "&quot;");
        }
        this.writer.print("\"" + value + "\"");
    }

    public void printTagOpen(String tagName) {
        this.writer.print("<" + tagName);
    }

    public void printTagOpenEnd() {
        this.writer.print(">");
    }

    public void printTagClose(String tagName) {
        this.writer.print("</" + tagName + ">");
    }

    public void printText(String string) {
        this.writer.print(string);
    }

    public void flush() {
    }
}
